package com.gjy.even;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-08-11 10:30:14
 */
@Configuration
@ConditionalOnProperty(value = "event.enable", havingValue = "true")
public class EventAutoConfiguration {
    private static final Logger log = LoggerFactory.getLogger(EventAutoConfiguration.class);

    @Bean
    public EventPublisher eventListener(List<EventListener> listeners) {
        EventPublisher eventPublisher = new EventPublisher(listeners);
        log.info("eventPublisher {}", eventPublisher);
        return eventPublisher;
    }
}
